# move the orange block to the purple bowl.
say('Sure - moving the orange block to the purple bowl')
put_first_on_second('orange block', 'purple bowl')

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# stack the red block on the yellow block on the brown bowl.
order_bottom_to_top = ['brown bowl', 'yellow block', 'red block']
say(f'Stacking the blocks in this order: {", ".join(order_bottom_to_top)}')
stack_objects_in_order(object_names=order_bottom_to_top)

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# move the red bowl to the top left corner.
corner_pos = parse_position('top left corner')
say('Moving the red bowl to the top left corner')
put_first_on_second('red bowl', corner_pos)

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# is the orange block on the purple bowl?
if parse_question('is the orange block on the purple bowl', f'objects = {get_obj_names()}'):
    say('Yes, the orange block is on the purple bowl.')
else:
    say('No, the orange block is not on the purple bowl.')

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# move all blocks to the center.
center_pos = parse_position('the center')
block_names = parse_obj_name('the blocks', f'objects = {get_obj_names()}')
say('Moving all blocks to the center')
for block_name in block_names:
    put_first_on_second(block_name, center_pos)

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# arrange the blocks in a circle around the purple bowl.
circle_pts = parse_position(f'a circle with radius 15cm around the purple bowl with {len(block_names)} points')
say('Arranging the blocks in a circle around the purple bowl')
for block_name, pt in zip(block_names, circle_pts):
    put_first_on_second(block_name, pt)

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# move the brown bowl to the bottom right corner.
corner_pos = parse_position('bottom right corner')
say('Moving the brown bowl to the bottom right corner')
put_first_on_second('brown bowl', corner_pos)

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# what is the color of the block on the purple bowl?
block_on_purple_bowl = parse_question('what is the color of the block on the purple bowl', f'objects = {get_obj_names()}')
if block_on_purple_bowl:
    say(f'The block on the purple bowl is {block_on_purple_bowl}.')
else:
    say('There is no block on the purple bowl.')

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# move the red block to the left of the orange block.
target_pos = parse_position('a point 10cm to the left of the orange block')
say('Moving the red block to the left of the orange block')
put_first_on_second('red block', target_pos)

objects = ['yellow block', 'orange block', 'red block', 'brown bowl', 'purple bowl', 'red bowl']
# rotate the circle of blocks by 90 degrees.
rotated_pts = transform_shape_pts('rotate it by 90 degrees', shape_pts=circle_pts)
say('Rotating the circle of blocks by 90 degrees')
for block_name, pt in zip(block_names, rotated_pts):
    put_first_on_second(block_name, pt)
